/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.forward.mobile.optitrans.domain;

import java.io.Serializable;
/**
 *
 * @author jbromo
 */
public class Position implements Serializable, Comparable<Position>{

    private static final long serialVersionUID = 1L;
    private int idVehicule;
    private int idDevice;
    private int idChauffeur;
    private double latitude;
    private double longitude;
    private double vitesse;
    private String status;
    private long dateGPS;

    public int getIdChauffeur() {
        return idChauffeur;
    }

    public void setIdChauffeur(int idChauffeur) {
        this.idChauffeur = idChauffeur;
    }
    

    public Position() {
    }

     
     

    
   

    public int getIdVehicule() {
        return idVehicule;
    }

    public int getIdDevice() {
        return idDevice;
    }

    public long getDateGPS() {
        return dateGPS;
    }

 
    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getVitesse() {
        return vitesse;
    }

    public void setVitesse(double vitesse) {
        this.vitesse = vitesse;
    }

    

    public String getStatus() {
        return status;
    }

    public void setIdVehicule(int idVehicule) {
        this.idVehicule = idVehicule;
    }

    public void setIdDevice(int idDevice) {
        this.idDevice = idDevice;
    }

    public void setDateGPS(long dateGPS) {
        this.dateGPS = dateGPS;
    }

    public void setStatus(String status) {
        this.status = status;
    }



    @Override
    public int compareTo(Position o) {
      return this.dateGPS==o.dateGPS?0:(this.dateGPS<o.dateGPS?-1:1);
    }

   public String toSaveFormat(){
       StringBuilder builder=new StringBuilder();
       builder.append(latitude);
       builder.append(";");
       builder.append(longitude);
       builder.append(";");
       builder.append(vitesse);
       builder.append(";");
       builder.append(status);
       builder.append(";");
       builder.append(dateGPS);     
       return builder.toString();
   }
}
